package com.wteam.config;

import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.CorsRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

@Configuration//开启同意跨域
public class CorConfig implements WebMvcConfigurer {
    @Override
    public void addCorsMappings(CorsRegistry corsRegistry) {
        corsRegistry.addMapping("/**")
                //设置同意跨域请求的域名
                .allowedOrigins("/*")
                //是否同意cookie
                .allowCredentials(true)
                //设置同意的请求方式
                .allowedMethods("POST", "GET", "PUT", "OPTIONS", "DELETE")
                //允许header属性
                .allowedHeaders("*")
                //跨域允许时间
                .maxAge(3600);


    }


}
